package com.xuchaotong.zk.server.controller;

import com.xuchaotong.zk.server.service.NotifyZookeeperService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author 311633
 * @version 1.0
 * @ClassName:
 * @Description:
 * @date 2017/11/20 16:50
 */
@Controller
@RequestMapping("/zk")
public class NotifyController {
    private static final Logger LOG = LoggerFactory.getLogger(NotifyController.class);

    @Autowired
    private NotifyZookeeperService notifyZookeeperService;

    @RequestMapping(value = "/notify/{val}", method = RequestMethod.GET)
    @ResponseBody
    public String updateNotify(@PathVariable String val) {
        String path = "/nodeRoot";
        LOG.info("参数：{}", val);
        return notifyZookeeperService.notifyZookeeper(path, val);
    }
}
